﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pavilion.DesignerTool
{
    public class AnimationNodeWrapper : NodeBaseWrapper
    {
        public AnimationData AssociatedAnimation { get { return base.NodeScriptWrapper.ResourceData.GetAnimationData(animationNode.Animation); } set { SetAssociatedAnimation(value); } }

        private AnimationNode animationNode;

        public AnimationNodeWrapper(AnimationNode animationNode, NodeScriptWrapper nodeScriptWrapper) : base(animationNode, nodeScriptWrapper)
        {
            this.animationNode = animationNode;
        }

        private void SetAssociatedAnimation(AnimationData value)
        {
            animationNode.Animation = (value == null) ? null : value.Animation;

            NodeTransfer.UpdateAnimationNode(NodeScriptWrapper.ResourceData.ResourceName, NodeScriptWrapper.Name, animationNode);
        }
    }
}
